/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bionic.ce.daoimplementation;

import com.bionic.ce.connections.MySQLDAOFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author Jarik
 */
public class MYSQLDAO {

    protected Connection connection = null;
    protected PreparedStatement ptmt = null;
    protected ResultSet resultSet = null;

    protected Connection getConnection() {
        connection = MySQLDAOFactory.createConnection();
        return connection;
    }

    protected void rollbackQuietly(Connection connection) {
        try {
            if (connection != null) {
                connection.rollback();
            }
        } catch (SQLException e) {
            //NOP
        }
    }

    protected void closeQuietly(Connection connection) {
            if (connection != null) {
                MySQLDAOFactory.freeConnection(connection);
            }
    }

    protected void closeQuietly(PreparedStatement ptmt) {
        try {
            if (ptmt != null) {
                ptmt.close();
            }
        } catch (SQLException e) {
            //NOP;
        }
    }
}
